﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Linq;

namespace jqGridTest
{
    /// <summary>
    /// Summary description for TestService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [ScriptService]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class TestService : System.Web.Services.WebService
    {
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
        public TestData[] Test()
        {
            var result = new List<TestData>();
            for (int i = 0; i < 100; i++)
            {
                result.Add(new TestData()
                {
                    aDateTime = DateTime.Now,
                    aDecimal = 0.1M,
                    anInteger = 111,
                    aString = "cool it works!"
                });
            }
            return result.ToArray();
        }
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
        public TestData[] TestWithParam(int test)
        {
            var result = new List<TestData>();
            for (int i = 0; i < 100; i++)
            {
                result.Add(new TestData()
                {
                    aDateTime = DateTime.Now,
                    aDecimal = 0.1M,
                    anInteger = test,
                    aString = "cool it works!"
                });
            }
            return result.ToArray();
        }
    }
}
